package vietnam.traveltools;

import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;

public class ShortcutsActivity extends Fragment implements OnClickListener {

//	private Button btnGps;
//	private Button btnMobiledata;
//	private Button btnWifi;
	private Button btnLocation;
	private Button btnTravel;
	private Button btnFood;
	private Button btnTaxi;
	private Button btnFavorite;
	private Button btnHotel;
	// private Button btnAtm;
	private Button btnAtm;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		View rootView = inflater.inflate(R.layout.shortcuts_activity,
				container, false);

		// Button btnGps = (Button) rootView.findViewById(R.id.gps);
		// Button btnMobiledata = (Button)
		// rootView.findViewById(R.id.mobiledata);
		// Button btnWifi = (Button) rootView.findViewById(R.id.wifi);
		btnLocation = (Button) rootView.findViewById(R.id.location);
		btnTravel = (Button) rootView.findViewById(R.id.travel);
		btnFood = (Button) rootView.findViewById(R.id.food);
		btnTaxi = (Button) rootView.findViewById(R.id.taxi);
		btnFavorite = (Button) rootView.findViewById(R.id.favorite);
		btnHotel = (Button) rootView.findViewById(R.id.hotel);
		// Button btnAtm = (Button) findViewById(R.id.atm);
		btnAtm = (Button) rootView.findViewById(R.id.atm);

		// btnGps.setOnClickListener(this);
		// btnMobiledata.setOnClickListener(this);
		// btnWifi.setOnClickListener(this);
		btnLocation.setOnClickListener(this);
		btnTravel.setOnClickListener(this);
		btnFood.setOnClickListener(this);
		btnTaxi.setOnClickListener(this);
		btnFavorite.setOnClickListener(this);
		btnHotel.setOnClickListener(this);
		// btnAtm.setOnClickListener(this);
		btnAtm.setOnClickListener(this);
		return rootView;
	}

	public void onClick(View v) {

		switch (v.getId()) {

		// case R.id.gps:
		// Toast.makeText(getActivity(), "Click GPS", Toast.LENGTH_SHORT)
		// .show();
		// break;
		// case R.id.wifi:
		// Toast.makeText(getActivity(), "Click WIFI", Toast.LENGTH_SHORT)
		// .show();
		// break;
		// case R.id.mobiledata:
		// Toast.makeText(getActivity(), "Click MOBILEDATA",
		// Toast.LENGTH_SHORT).show();
		// break;

		case R.id.location:
			// Toast.makeText(getActivity(), "Chức năng đang được xây dựng",
			// Toast.LENGTH_SHORT).show();

			 ((MainActivity) getActivity()).actionBar
			 .setSelectedNavigationItem(3); // Maps index = 3
			// getActivity().overridePendingTransition(R.anim.right_in,
			// R.anim.left_out);

			break;

		case R.id.travel:
			Toast toast_travel = Toast.makeText(getActivity(),
					"Gõ từ  khoá bạn muốn tìm kiếm", Toast.LENGTH_LONG);
			toast_travel.setGravity(Gravity.CENTER, 0, 0);
			toast_travel.show();
			Intent intent_travel = new Intent(getActivity(),
					TravelActivity.class);
			startActivity(intent_travel);
			getActivity().overridePendingTransition(R.anim.right_in,
					R.anim.left_out);
			break;

		case R.id.food:
			Toast toast_food = Toast.makeText(getActivity(),
					"Gõ từ  khoá bạn muốn tìm kiếm", Toast.LENGTH_LONG);
			toast_food.setGravity(Gravity.CENTER, 0, 0);
			toast_food.show();
			Intent intent_food = new Intent(getActivity(), FoodActivity.class);
			startActivity(intent_food);
			getActivity().overridePendingTransition(R.anim.right_in,
					R.anim.left_out);
			break;

		case R.id.taxi:
			Toast toast_taxi = Toast.makeText(getActivity(),
					"Gõ từ  khoá bạn muốn tìm kiếm", Toast.LENGTH_LONG);
			toast_taxi.setGravity(Gravity.CENTER, 0, 0);
			toast_taxi.show();
			Intent intent_taxi = new Intent(getActivity(), TaxiActivity.class);
			startActivity(intent_taxi);
			getActivity().overridePendingTransition(R.anim.right_in,
					R.anim.left_out);

			break;

		case R.id.favorite:
			Toast.makeText(getActivity(), "Chức năng đang được xây dựng",
					Toast.LENGTH_SHORT).show();
			break;

		case R.id.hotel:
			// Toast.makeText(getActivity(), "Click HOTEL", Toast.LENGTH_SHORT)
			// .show();
			Toast toast_hotel = Toast.makeText(getActivity(),
					"Gõ từ  khoá bạn muốn tìm kiếm", Toast.LENGTH_LONG);
			toast_hotel.setGravity(Gravity.CENTER, 0, 0);
			toast_hotel.show();
			Intent intent_hotel = new Intent(getActivity(), HotelActivity.class);
			startActivity(intent_hotel);
			getActivity().overridePendingTransition(R.anim.right_in,
					R.anim.left_out);

			break;

		case R.id.atm:
			Toast toast_atm = Toast.makeText(getActivity(),
					"Gõ từ  khoá bạn muốn tìm kiếm", Toast.LENGTH_LONG);
			toast_atm.setGravity(Gravity.CENTER, 0, 0);
			// LinearLayout toastView = (LinearLayout) toast.getView();
			// ImageView imageShow = new ImageView(getActivity());
			// imageShow.setImageResource(R.drawable.sure);
			// toastView.addView(imageShow, 0);
			toast_atm.show();

			// Toast.makeText(getActivity(),
			// getResources().getDrawable(R.drawable.tab_main)+"Gõ từ khoá bạn muốn tìm kiếm",
			// Toast.LENGTH_SHORT)
			// .show();
			Intent intent_atm = new Intent(getActivity(), AtmActivity.class);// getActivity()
			startActivity(intent_atm);
			getActivity().overridePendingTransition(R.anim.right_in,
					R.anim.left_out);
			break;
		}

	};
}